package org.rambadger.command.event;

import org.rambadger.command.validation.UrlIdentifier;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.io.Serializable;

public class SubmissionPublished implements Serializable {
    private static final long serialVersionUID = 7920782041212167140L;
    //Compound Key {
    private final String username;
    private final int submissionId;
    //}
    //Compound Key {
    private final String platformId;
    private final String assignmentId;
    //}

    public SubmissionPublished(String username, int submissionId, String platformId, String assignmentId) {
        this.username = username;
        this.submissionId = submissionId;
        this.platformId = platformId;
        this.assignmentId = assignmentId;
    }

    @UrlIdentifier @NotNull
    public String getUsername() {
        return username;
    }

    @Min(1)
    public int getSubmissionId() {
        return submissionId;
    }

    @UrlIdentifier @NotNull
    public String getPlatformId() {
        return platformId;
    }

    @UrlIdentifier @NotNull
    public String getAssignmentId() {
        return assignmentId;
    }

    public String getFullSubmissionId() {
        return username+"/"+submissionId;
    }

    public String getFullAssignmentId() {
        return platformId+"/"+assignmentId;
    }

    @Override
    public String toString() {
        return "SubmissionPublished{" +
                "username='" + username + '\'' +
                ", submissionId=" + submissionId +
                ", platformId='" + platformId + '\'' +
                ", assignmentId='" + assignmentId + '\'' +
                '}';
    }
}
